﻿using AnesSystem.Models;
using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// PacuSingleDrugConfigWin.xaml 的交互逻辑
    /// </summary>
    public partial class PacuSingleDrugConfigDialogCtrl : UserControl
    {

        #region Variables
        private static PacuSingleDrugConfigDialogCtrl _instance;
        #endregion

        #region Constructor


        public static PacuSingleDrugConfigDialogCtrl Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new PacuSingleDrugConfigDialogCtrl();
                }
                return _instance;
            }
        }
        public PacuSingleDrugConfigDialogCtrl()
        {
            InitializeComponent();
            this.DataContext = PacuSingleDrugConfigCtrlViewModel.Instance;
        }
        #endregion

        #region Properties

        #endregion

        #region 依赖属性

        #endregion

        #region Event

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers
        private void CtrlButton_Click(object sender, RoutedEventArgs e)
        {
            PacuSingleDrugConfigCtrlViewModel.Instance.AddSingleCtrl();
        }

        private void DrugButton_Click(object sender, RoutedEventArgs e)
        {
            ConfigDrugsModel drug = (sender as Button).DataContext as ConfigDrugsModel;
            PacuSingleDrugConfigCtrlViewModel.Instance.SelectedDrug = drug;
            PacuSingleDrugConfigCtrlViewModel.Instance.AddDrug();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string commond = (sender as Button).Tag.ToString();
            PacuSingleDrugConfigCtrlViewModel.Instance.Excute(commond);
        }
        #endregion


    }
}
